using System;
using UnityEngine;

public class GGNotificationsAndroid : GGNotifications
{
	private AndroidJavaObject javaInstance;

	public GGNotificationsAndroid()
	{
		if (Application.platform != RuntimePlatform.Android)
		{
			return;
		}
		using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.giraffegames.unityutil.GGNotifications"))
		{
			javaInstance = androidJavaClass.CallStatic<AndroidJavaObject>("instance", new object[0]);
		}
	}

	public override void CancelAllLocalNotifications()
	{
		if (Application.platform == RuntimePlatform.Android)
		{
			javaInstance.Call("ClearNotifications");
		}
	}

	public override void ScheduleLocalNotification(Notification notification)
	{
		int num = (int)Math.Round(notification.fireDate.Subtract(DateTime.Now).TotalSeconds);
		int secondsRepeat = notification.secondsRepeat;
		Debug.Log("Not " + notification.alertBody + " secFromNow " + num + " secRepeat " + secondsRepeat);
		if (Application.platform == RuntimePlatform.Android)
		{
			javaInstance.Call("ScheduleNotification", notification.alertAction, notification.alertBody, num, secondsRepeat);
		}
	}
}
